// 会话相关类型定义

export interface SessionData {
  userId: string;
  deviceId: string | undefined;
  userAgent: string | undefined;
  ipAddress: string | undefined;
  createdAt: Date;
  lastActivity: Date;
  expiresAt: Date | undefined;
  data: Record<string, any>;
}

export interface SessionInfo {
  sessionId: string;
  userId: string;
  deviceId: string | undefined;
  deviceType: string | undefined;
  location: string | undefined;
  createdAt: Date;
  lastActivity: Date;
  isActive: boolean;
}

export interface SessionConfig {
  defaultTtl: number;
  maxSessions: number;
  extendOnActivity: boolean;
  trackLocation: boolean;
  trackDevice: boolean;
}

export interface SessionStats {
  totalSessions: number;
  activeSessions: number;
  expiredSessions: number;
  averageSessionDuration: number;
  topUsers: Array<{
    userId: string;
    sessionCount: number;
  }>;
  deviceBreakdown: Record<string, number>;
}

export interface SessionCleanupResult {
  expiredSessions: number;
  inactiveSessions: number;
  totalCleaned: number;
  errors: Array<{
    sessionId: string;
    error: Error;
  }>;
}

export interface MultiDeviceSession {
  userId: string;
  sessions: SessionInfo[];
  primarySession?: string;
  maxDevices: number;
  conflictResolution: 'newest' | 'oldest' | 'manual';
}
